home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / bigfig.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  3.7 KB  |  129 lines

  1. /* the contents of the file have been merged into term/fig.trm */
  2. /* the file will go away soon */
  3.  
  4. #if 0
  5. /*
  6.  * $Id: bigfig.trm,v 1.30 1994/01/02 13:25:10 alex Exp $
  7.  */
  8.  
  9. /* GNUPLOT - fig.trm */
  10. /*
  11.  * Copyright (C) 1990, 1991, 1992
  12.  *
  13.  * Permission to use, copy, and distribute this software and its
  14.  * documentation for any purpose with or without fee is hereby granted,
  15.  * provided that the above copyright notice appear in all copies and
  16.  * that both that copyright notice and this permission notice appear
  17.  * in supporting documentation.
  18.  *
  19.  * Permission to modify the software is granted, but not the right to
  20.  * distribute the modified code.  Modifications are to be distributed
  21.  * as patches to released version.
  22.  *
  23.  * This software  is provided "as is" without express or implied warranty.
  24.  *
  25.  * This file is included by ../term.c.
  26.  *
  27.  * This terminal driver supports:
  28.  *  Fig graphics language
  29.  *
  30.  * AUTHORS
  31.  *  Micah Beck, David Kotz
  32.  *
  33.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  34.  *
  35.  */
  36.  
  37. /*
  38.  * Original for Fig code output by Micah Beck, 1989
  39.  * Department of Computer Science, Cornell University
  40.  * Updated by David Kotz for gnuplot 2.0
  41.  * More efficient output by Ian Dall
  42.  * Increased size of plot by Ian Dall
  43.  * Updated to FIG 2.1 (with color) by Vivek Khera
  44.  */
  45.  
  46. #define BFIG_HTIC       (7*FIG_RES/80)
  47. #define BFIG_VTIC       (7*FIG_RES/80)
  48. #define BFIG_FONT_S     (16)    /* size in points */
  49. #define BFIG_VCHAR      (BFIG_FONT_S*72/FIG_RES) /* height in pixels of font */
  50. #define BFIG_HCHAR      (BFIG_VCHAR*6/10) /* this is a guess at the width */
  51.  
  52. #define BFIG_ARROW_WIDTH (BFIG_HTIC/2 + 1)
  53. #define BFIG_ARROW_HEIGHT BFIG_HTIC
  54.  
  55.  
  56.  
  57. /* 8 inches wide by 5 inches high */
  58. #define BFIG_XMAX (8 * FIG_RES)
  59. #define BFIG_YMAX (5 * FIG_RES)
  60.  
  61. #define BFIG_XOFF (FIG_RES/2)
  62. #define BFIG_YOFF (FIG_RES/2)
  63.  
  64.  
  65. BFIG_vector(ux,uy)
  66.      unsigned int ux,uy;
  67. {
  68.   int x=ux, y=uy;
  69.  
  70.   if (FIG_polyvec_stat != FIG_poly_part)
  71.     {
  72.       fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d %d\n",
  73.               O_POLYLINE, T_POLYLINE,
  74.               FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing, 0,0,0);
  75.       fprintf(outfile, "%d %d",
  76.               BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
  77.       FIG_poly_vec_cnt = 1;
  78.       FIG_polyvec_stat = FIG_poly_part;
  79.     }
  80.   fprintf(outfile, " %d %d",
  81.           BFIG_XOFF +  x, BFIG_YMAX + BFIG_YOFF-y);
  82.   FIG_poly_vec_cnt++;
  83.   if (FIG_poly_vec_cnt > 50)
  84.     FIG_poly_clean(FIG_polyvec_stat);
  85.  
  86.   FIG_posx = x;
  87.   FIG_posy = y;
  88. }
  89.  
  90.  
  91. BFIG_arrow(sx, sy, ex, ey, head)
  92.         int sx, sy;     /* start coord */
  93.         int ex, ey;     /* end coord */
  94.     TBOOLEAN head;
  95. {
  96.     FIG_poly_clean(FIG_polyvec_stat);
  97.         fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d  %d %d\n",
  98.                 O_POLYLINE, T_POLYLINE,
  99.                 FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing,
  100.         0, head ? 1 : 0, 0);
  101.         /* arrow line */
  102.     if ( head )
  103.             fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  104.                     0, 0, 1.0,
  105.             (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
  106.         fprintf(outfile, "%d %d %d %d 9999 9999\n",
  107.                 BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
  108.         BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
  109.  
  110.         FIG_posx = ex;
  111.         FIG_posy = ey;
  112. }
  113.  
  114. BFIG_put_text(x, y, str)
  115.         int x, y;
  116.         char *str;
  117. {
  118.   if (strlen(str) == 0) return;
  119.   FIG_poly_clean(FIG_polyvec_stat);
  120.   y -= FIG_VCHAR/2;    /* assuming vertical center justified */
  121.  
  122.     fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  123.                   O_TEXT, FIG_justify,
  124.                   FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, 0,
  125.           FIG_angle, SPECIAL_TEXT, BFIG_VCHAR, BFIG_HCHAR*strlen(str),
  126.           BFIG_XOFF + x, BFIG_YMAX + BFIG_YOFF-y, str);
  127. }
  128. #endif
  129.